<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006~2017 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 李邦琦 <1536549251@qq.com>
// +----------------------------------------------------------------------

namespace app\crm\controller;
use think\Loader;

class Signcount extends CrmController
{
    /**
     * signCount
     */
    public function signCount()
    {
        // 模板输出
        return $this->fetch('signCount');
    }


    /**
     * 获取考勤统计
     * @return [json] [考勤数据]
     */
    public function signCountData()
    {
        $page = $_REQUEST["page"];
        $limit = $_REQUEST["limit"];
        //需先判断传值是否为空
        $where = "(1 ";
        $where .= empty($_REQUEST["username"])?"":" AND username = '".$_REQUEST["username"]."'";
        $where .= empty($_REQUEST["start_signtime"])?"":" AND signtime > '".$_REQUEST["start_signtime"]."'";
        $where .= empty($_REQUEST["end_signtime"])?"":" AND signtime < '".$_REQUEST["end_signtime"]."'";
        $where .= " )";

        $arrData = Loader::model('Signcount')->getSignCountData($where,$page,$limit);
        echo json_encode($arrData);
    }




}